Moved code from script into new class 'Skymachine'