refactored to work on centos6 out of the box. needs testing across platforms