added scaling and garbage collection