Simplified code, deleted all two-line functions