Made some changes based on Martin