code refactor and added #method_missing tests