Moved scope of some objects to allow more functionality