Added comments, it's working but have bugs