code and external library clean up