changes and bug fixes based on Sean feedback