Cleaned up DOM traversal methods