[FIX] Re-factor code
[FIX] Re-factor code to make it more read-able