code cleanup + improved user interaction with typecheck and compile buttons