Added more comments and removed orphan code