restructured code: init, reshape