better error handling, remove unnecessary Box class, improved APIs