REFACTORING!!! xpath ftw!