code cleanup and usability improvements