minor code modification to comply with PSR-2
optimized the code for internal function to handle url building