Overhaul

Merging some found similar coding and reducing lines and making it more clever.