updates to the api

also cleans tons of code