Added comments and fixed a bug in onestepCD