Refactored till the end. All commented and cool.