First working version. Will be upgraded soon.