S3 methods added. Code stye improved, particularly naming conventions