Fixed bug in "open" & "close" method callback / Refactoring