cleaned up schedule controller code