Added .onAttach and .onLoad functions