Code after removing comments and unneccesary if-statements