split code into more than one function
fix url masking