Updated to use sin function.