removed some more redundancy and improved runtime by half I think