Implementation of first version