formatting and bug fixes, more coverage