Yet pretty basic and simple implementation.
(Probably little bit too simple and should be improved...)