moved solution code