some cleanup and requirejs support