little more to be done stylewise but this should work, will be adding the final edition before midnight