Made code more legible

Updated comments, indentation and spacing
Close top panels when pressing the escape key
Added tab support