concatenated if statements, added keywords, various minor improvements