cleaned up code in schedule view