moved proto code to proto