wrapping up initial script, needs testing