code reviewed and bug fixes