Cleaned up scripts a bit and added retention policy support