Added initial functional version