Separating some code
Adding comments