replaced gets with scanf