Small bug/technical changes

Please review before fully committing the changes.