finished working copy, needs validation and gui tweaks