Better version, less copypaste code.