working version without database