mostly functional

needs bug fixing but hey