Code Refactored

Re wrote some code, made everything mode concise