continuing temp implementation (its getting bigger, should move it to a better file soon)