reduce mem usage
minor changes