fix state and cleanup imports