refactored mistakes due to sleepiness