Added implementation for open and cleaned up some other stuff that's not needed anymore