Input fixes and cleanup