cleanup and general fixes