clean up unused code
modularize utilities