Fixed formatting and simplified
Simplified, improved
Reimplemented with for
Fixed namespace issues