basic working functional - now to improve