cleaned up script, improved binding.