Added comments and removed transition bug