Compressed code with common functions, added some transients + other
things