refactoring parse logic