refactored plate and code cleaning