Added feature to replace onOpen