possible solution by fredrik!