add some comments
corrected some method calls
add 'else if' as nested statement