moved method and added comments