script sample ported, working