and the code can be written as such