modularize; added hashchange events