well working version with ramping