Revert "Integrating Ricardo K's code with added code"

This reverts commit b0d003339e363aece8b8aeee216639e17b37cf67.