working version without mongo