made put method more flexible