First version of working script