got everything working and added commenting