API tweaks

Some tweaks and optimizations to the API