bug fixes and organization