First working version (without db support)