Added new features. See bug: #261 and #262