Final changes and bug fixes