removed dupe code and used trait method instead