cleaned up editor window code to make it more organized