Use url/l functions for paths instead of hardcoding ?q= paths
More code cleanup