add second attempt
clean up / rewrite code