Code Refactor + some documentation