Some basic optimizations, increased readability