added free ram code