Implementing both feature #81 and #61

Implemented #81 and #61