Added some functionality. Untested