first commit with basic energy spending implemented