fix url and cleanup code