Added more special cases at the edges
added a to-do-list