Stop using rand
Fix returning URL
Create method for generating URL
Add tests