updating permalinks to use some built in strings functions and cleaning up the file