Added rough open, close
Exception handling added