basic framework, copied in motion functions