Refactoring code for PEP8 rules; Added url_for.