Don't blame me for the code quality, it is simple academic project I needed to finish...