Fixed errors, removed deprecated code