stuck logic and bug fixes