lots of cleanup and adding more features