Revert "Removing unecessary code and minor fixes"

This reverts commit ed72651fff5c10733bd7e83f16b3a402f6f4c76c.